Skip to main content

All Questions

3votes
1answer
3kviews

Java n-ary Tree class with custom made methods and nested Node class

I'm a beginner and I wrote this (working) code for n-ary tree. The specifics: Each node is to be built with an integer value. Each node has a variable number of children. The nodes should have an ...
Ary's user avatar
  • 41
0votes
1answer
2kviews

Generic Binary Search Tree Implementation in Java

There is an implementation of Binary Search Tree. This is kind of based on Set Theory that duplicates are not allowed but an attempt to adding the same node twice will replace the older node. BSTNode ...
Hamidur Rahman's user avatar
2votes
1answer
346views

Object oriented design for a Tree

I am implementing a Tree in Java. It must be easy to add a new type of tree e.g. Binary tree and Tertiary tree. Each node can have at least one value. It must be easy to make a new type of node and ...
Varun Raval's user avatar
1vote
1answer
122views

Walk on tree with different actions on different nodes

I have a tree whose nodes are of type Node. Depending on the type (one of the implementations of Node) nodes differ in the set ...
Valeriy's user avatar
1vote
1answer
749views

Count number of leaves in binary tree

Description: Given a binary tree find the number of leaves. Although the problem is simple and has been solved many times I am more interested in find object oriented ways to solve the algorithmic ...
CodeYogi's user avatar
1vote
1answer
2kviews

RB Tree Left and Right Rotate Functions

I am writing a program to implement the Red-Black Tree data structure in java. Below is the beginning of my implementation, namely the left and right rotate functions. I want to know if these ...
Will's user avatar
1vote
1answer
973views

Method that remove duplicates from a list of words in Java [closed]

Today, I took a coding challenge with this question: Given a List of Strings, write a method removeDuplicates that removes duplicate words from the List and returns an ArrayList of all the unique ...
TheLearner's user avatar
6votes
4answers
669views

Count number of nodes in a binary tree the OO way

I am trying to write a simplify the algorithm of finding the number of nodes in a binary tree by using good object oriented design. I have been into good OOP style recently and found it really ...
CodeYogi's user avatar
4votes
2answers
1kviews

Binary search tree in Java with only one class

I have written a BST using one class. Is my code okey or something could be better? ...
user96160's user avatar
10votes
1answer
1kviews

Generic domain independent Monte Carlo Tree Search methods library

I've written this small generic library for the purpose of my Bachelor's thesis. It's fully functional and unit tested and I want to get as many opinions as possible regarding overall code quality (...
inejc's user avatar
3votes
2answers
2kviews

Constructing a binary tree in java

I am constructing a binary tree. Let me know if this is a right way to do it. If not please tell me how to?? I could not find a proper link where constructing a general binary tree has been coded. ...
VIN's user avatar
  • 135

close